home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / raytrace / radiance / simplerd.lha / simplerad / FinalFTP / Light / rad.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-21  |  4.8 KB  |  91 lines

  1. /**********************************************************************/
  2. /* rad.h                                                              */
  3. /*                                                                    */
  4. /* Radiosity structures                                               */
  5. /*                                                                    */
  6. /* Copyright (C) 1992, Bernard Kwok                                   */
  7. /* All rights reserved.                                               */
  8. /* Revision 1.0                                                       */
  9. /* May, 1992                                                          */
  10. /**********************************************************************/
  11. #ifndef RAD_H
  12. #define RAD_H
  13.  
  14. #define kBackgroundItem 0xffffff  /* Background colour for item buffer*/
  15. #ifndef RAND_MAX                  /* Random float generator           */
  16. #define RAND_MAX 32767
  17. #endif 
  18. #define RandomFloat ((float) (rand()) / (float)RAND_MAX)
  19.  
  20. /* Interpolation types */
  21. #define INTERP_VTX_FROM_PATCH 0   /* Patches to vertices             */
  22. #define INTERP_VTX_FROM_VTX 1     /* Vertices to vertices            */
  23.  
  24. #define RAD_THRESHOLD  (0.001)/* Stopping threshold                  */
  25. #define RAD_ITERATIONS (100)  /* Stopping # of iterations            */
  26.  
  27. typedef struct {              /* Camera                              */
  28.   Vector lookfrom;            /* Position looking from               */
  29.   Vector lookat;              /* Position looking at                 */
  30.   Vector lookup;              /* Direction up                        */
  31.   int fovx, fovy;             /* Field of view in x,y                */
  32.   double near, far;           /* Near / far clipping planes          */
  33.   short xRes, yRes;           /* Resolution of viewing plane         */
  34.   unsigned long *buffer;      /* Buffer for item buffering           */
  35.   double bank;                /* Bank angle                          */
  36. } Camera;
  37.  
  38. typedef struct Elist {        /* List of elements for calc. ffs       */
  39.   Polygon *element;           /* Potential receiver element           */
  40.   struct Elist *next;         /* Next element in list                 */
  41.   double ff;                  /* form factor for element              */
  42.   double vtx_ff[MAX_PATCH_VTX]; /* form factor for element vertices   */
  43.   int is_receiver;            /* Is a receiver for current source     */
  44.   int is_subdivided;          /* Has been subdivided in current iter. */
  45. } Elist;
  46.  
  47. typedef struct {              /* Radiosity parameters                 */
  48.   int log;                    /* Log reading of objects               */
  49.   int objcount;               /* Number of objects read               */
  50.   int meshcount;              /* Number of meshes read                */
  51.   int polycount;              /* Number of polygons per mesh          */
  52.   int totpoly;                /* Total number of polygons read        */
  53.   int totmesh;                /* Total number of meshes read          */
  54.   int num_objects;            /* Total number of objects read         */
  55.   int num_textures;           /* Total number of textures read        */
  56.  
  57.   int num_elements;           /* Current number of elements in scene  */
  58.   int num_receivers;          /* Number of receivers for cur. source  */
  59.   Elist *elements;            /* Current set of elements in scene     */
  60.   Elist *eltail;
  61.  
  62.   double threshold;           /* convergence threshold 
  63.                  (fraction of total emitted energy)   */
  64.   int max_iterations;         /* Maximum number of allowed iterations */
  65.   int forming_links;          /* if TRUE, Forming patch linkages.     */
  66.   double intensityScale;      /* Used to scale intensity for display  */
  67.   short hemicubeRes;          /* Hemicube resolution                  */
  68.   int writerad;               /* Output radiosity solution            */
  69.   double worldSize;           /* Bounding sphere radius of the world  */
  70.   BoundingBoxType worldbox;   /* Bounding box of the world            */
  71.  
  72.   Camera displayView;         /* View to examine PR with              */
  73.   double totalEnergy;         /* Total emitted energy; used for 
  74.                  convergence checking                 */
  75.   double totalEnergyLeft;     /* Total energy left in scene at iter.  */
  76.   double totalArea;           /* Total area in the scene              */
  77.   Spectra ptotalArea;         /* Summed p * are for all patches       */
  78.   Spectra ambient_term;       /* Ambient term (for display only !)    */
  79. } RadParams;
  80.  
  81. typedef struct {              /* Hemicube                             */
  82.   Camera view;                /* Viewing parameters                   */
  83.   double *topFactors;         /* Form factors for top plane           */
  84.   double *sideFactors;        /* Form factors for side planes         */
  85.   int buffersize;             /* Size of item buffer                  */
  86. } Hemicube;
  87.  
  88. #endif /* RAD_H */
  89.  
  90.  
  91.